<?php

namespace App\Http\Requests\Logic\Project;

use Illuminate\Foundation\Http\FormRequest;

class StoreResource extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

	/**
	 * 定义表单验证规则
	 *
	 * Date: 11/04/2018
	 * @author George
	 * @return array
	 */
    public function rules()
    {
        return [
        	'name' => 'required',
        	'company_id' => 'required',
        	'address' => 'required',
        	'longitude' => 'required',
        	'latitude' => 'required',
        	'radius' => 'required|integer',
        	'cover' => 'nullable'
        ];
    }

	/**
	 * 定义表单验证错误消息
	 *
	 * Date: 11/04/2018
	 * @author George
	 * @return array
	 */
	public function messages()
	{
		return [
			'name.required' => '请输入名称',
			'company_id.required' => '请输入公司ID',
			'address.required' => '请输入地址',
			'longitude.required' => '请选择经度',
			'latitude.required' => '请选择纬度',
			'radius.required' => '请设置有效考勤范围',
			'radius.integer' => '设置的范围值不正确，单位：米',
		];
    }
}
